<%@ page contentType="text/html;charset=UTF-8" %>
		<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
		<html>
		<head>
			<title>回复管理</title>
			<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
			<meta name="decorator" content="default" />
			<%@ include file="/WEB-INF/views/include/bootstrap-table.jsp"%>
			
			<style type="text/css">
				.date-field-class{
				  width: 100px;
				}
			</style>
		</head>
		
<body>
 <div class="layui-fluid" style="">		
			<div class="layui-row">
			        <blockquote class="layui-elem-quote news_search">
			            <form id="searchForm">
			                <div class="layui-inline"> 
											发布平台:
											 <div class="layui-input-inline">
											     <div class="checkbox icheck-nephritis checkbox-extend">
													<input type="checkbox" name="doPlatform" value="1" id="dy" />
													<label for="dy">抖音</label>
						                          </div>
						                          <div class="checkbox icheck-nephritis checkbox-extend">
													<input type="checkbox" name="doPlatform" value="2" id="ks" />
													<label for="ks">快手</label>
						                         </div>
						                         <div class="checkbox icheck-nephritis checkbox-extend">
													<input type="checkbox" id="xhs" name="doPlatform" value="3" />
													<label for="xhs">小红书</label>
						                         </div>
											   </div>
											回复关键字:
											<div class="layui-input-inline">
								               <input id="replyKeys" name="replyKeys"  class="layui-input search_input" type="text">
								            </div>
					              <a  id="btn_search" class="layui-btn search_btn">查询</a>
					              <a  id="btn_reset" onclick="formResetBySearch();" class="layui-btn layui-btn-primary search_btn">重置</a>
					          </div>
						</form>	
					</blockquote>
			</div>
			
			<div id="toolbar">
				    <div class="layui-btn-group">
					     <shiro:hasPermission name="content:contentReply:create">
							<button type="button" class="layui-btn layui-btn-normal layui-btn-sm"  onclick="gotoView('${ctx}/content/contentReply/contentReplyForm');">
							       新增
							</button>
						 </shiro:hasPermission>	
						 <shiro:hasPermission name="content:contentReply:delete">
							<button type="button" class="layui-btn  layui-btn-normal layui-btn-sm" onclick="batchDelete('${ctx}/content/contentReply/batchDelete');">
								  删除
							</button>
						 </shiro:hasPermission>	
			        </div>
				</div>	
					
				<table id="table" 
						 data-toggle="table" 
						 data-url="${ctx}/content/contentReply/contentReplyListJson"
						 data-toolbar="#toolbar"
						 data-maintain-selected="true" 
						 data-side-pagination="server"
						 data-click-to-select="true" 
						 data-pagination="true" 
						 data-single-select="false"
						 data-id-field="id"
						 data-query-params="doQuery"
						 data-cache="false"
						 data-show-columns="true"
						 data-page-list="${dataPageList}">
						 
						<thead>
							<tr>
								<!-- data-sortable="true" 排序 -->
							    <!-- data-visible="false" 可以隐藏列 -->
								<th data-checkbox="true"></th>
									   <th data-field="doPlatform" data-formatter="doPlatformFormatter" data-align="left" >发布平台</th>
									   <th data-field="accounts" data-formatter="accountsFormatter" data-align="left" >发布平台</th>
									   <th data-field="replyKeys" data-align="left" >回复关键字</th>
									   <th data-field="replyInfo" data-align="left" >回复内容</th>
									   <th data-field="updateDate" data-align="left" >更新时间</th>
									   <th data-field="remarks" data-align="left" >备注信息</th>
								<th data-field="id" data-formatter="operationFormatter" class="date-field-class">操作</th>
							</tr>
						</thead>
					</table>
				</div>

			
<script type="text/javascript">
			var $table = $('#table');
			$(function () { 
			    $("#btn_search").click(function () { 
			    	 $table.bootstrapTable('refresh', {query: $('#searchForm').serializeObject()});
			    }); 
			}); 
			  
			//查询函数
			function doQuery(params) {
				return params;
			}
			
			/**
			*  操作项  add for lgx  提供查看，修改，删除按钮，如果还有系统按钮，
			*  比如禁用，可在子页面进行自定义函数添加（建议列表操作项按钮不要超过5个）
			*/
			function operationFormatter(value, row){
				var hasView = '${fns:hasPermission("content:contentReply:view")}';
				var hasEdit = '${fns:hasPermission("content:contentReply:edit")}';
				var hasDelete = '${fns:hasPermission("content:contentReply:delete")}';
				
				var params = "id="+value;
				//查看
				//var html = '<a href="javascript:void(0);" style="padding-right:5px;" onclick="detail(\'content/contentReply/contentReplyDetail\',\'查看回复管理信息\',\''+params+'\')">查看</a>';
				//修改
				var html = '';
				
			    if(hasEdit == 'true'){
			    	html = html + '<a href="javascript:void(0);" class="layui-btn layui-btn-xs" style="padding-right:5px;" onclick="gotoView(\'${ctx}/content/contentReply/contentReplyForm?'+params+'\');">修改</a>';
				}else{
					html = html + ' <button class="layui-btn layui-btn-disabled layui-btn-xs">修改</button>';
				} 
		
			    if(hasDelete == 'true'){
					//删除
					html= html +'<a href="javascript:void(0);" class="layui-btn layui-btn-danger layui-btn-xs" onclick="deleteData(\'content/contentReply/deleteAjax\',\'是否删除数据？\',\''+params+'\')">删除</a>';
			    }else{
			    	html = html + '<button class="layui-btn layui-btn-disabled layui-btn-xs">删除</button>';
			    }
				
				return html;
			}  
			
			function doPlatformFormatter(value, row){
				var zh = "";
				if(value != null && value != ""){
					var arr = value.split(",");
					for(j = 0,len=arr.length; j < len; j++) {
					    if(arr[j] == "1"){
					    	zh = zh + "抖音" +",";
					    }else if(arr[j] == "2"){
					    	zh = zh + "快手" +",";
					    }else if(arr[j] == "3"){
					    	zh = zh + "小红书" +",";
					    }
					}
					zh = zh.substring(0, zh.lastIndexOf(',')); 
					return zh;
				}else{
					return value;
				}
			}
			
			function accountsFormatter(value, row){
				if(value != "" && value != null) {
					return "部分账号";
				}else{
					return "全部账号";
				}
			}
			
			
			</script>
			
			<jsp:include page="/WEB-INF/views/include/pageJs.jsp" />
		</body>
		
		</html>